package com.wngbms;

public class ThreadLocalDemo {


    public static void main(String[] args) {

        ThreadLocal<String> threadLocal1 = ThreadLocal.withInitial(() -> "1234");
        ThreadLocal<String> threadLocal2 = ThreadLocal.withInitial(() -> "2345");

        threadLocal1.set("now1");
        threadLocal2.set("now2");

        System.out.println(threadLocal1.get());
        System.out.println(threadLocal2.get());

        new Thread(() -> {
            System.out.println(threadLocal1.get());
            System.out.println(threadLocal2.get());
        }).start();
    }

}
